JBoss Community Archive (Read Only)

GateIn Portal 3.7

Database Configuration

In GateIn Portal 3.7, there are two services which require a relational database. One is the Identity Management (IDM) Service, which accesses the database via Hibernate, and the other one is Java Content Repository (JCR) Service using JDBC directly. Both of them can integrate with any available JDBC datasource implementation and they do not necessarily need to use the same database server.

When you change the database configuration for the first time, GateIn Portal will automatically generate the proper schema (assuming that the database user has the appropriate permissions).

GateIn Portal assumes that the default encoding for your database is latin1. You may need to change this parameter for your database in order for portal to work properly.

Configuring the databases on JBoss AS7

On JBoss, the configuration of JCR, and IDM services is set to use a container provided datasources, configured through AS7 configuration. See https://docs.jboss.org/author/display/AS7/DataSource+configuration for instructions on how to configure a DataSource on AS7.

Portal datasource configuration can be found in $JBOSS_HOME/standalone/configuration/standalone.xml.

Configuring the database for JCR

JCR uses the datasource bound to JNDI under: java:/jdbcjcr_portal.

<datasource jndi-name="java:/jdbcjcr_portal" pool-name="JCRPortalDS" enabled="true" use-java-context="true">

    <connection-url>jdbc:h2:file:${jboss.server.data.dir}/gatein/portal/jdbcjcr_portal;DB_CLOSE_DELAY=-1</connection-url>
    <driver>h2</driver>

    <security>
        <user-name>sa</user-name>
        <password>sa</password>
    </security>

</datasource>

If additional portals are deployed, additional datasources have to be configured and bound in JNDI under java:/jdbcjcr_PORTAL-NAME for each additional portal deployed.

Make sure the user has rights to create tables in jdbcjcr_portal, and to update them as they will automatically be created during the first startup.

Configuring the database for the default identity store

IDM datasource configuration is analogous to JCR datasource configuration.

IDM uses the datasource bound to JNDI under: java:/jdbcidm_portal.

<datasource jndi-name="java:/jdbcidm_portal" pool-name="IDMPortalDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:h2:file:${jboss.server.data.dir}/gatein/portal/jdbcidm_portal;DB_CLOSE_DELAY=-1</connection-url>
    <driver>h2</driver>
    <security>
        <user-name>sa</user-name>
        <password>sa</password>
    </security>
</datasource>

Configuring the databases on Tomcat

On Tomcat, the configuration of JCR, and IDM services is set to use application provided datasources. It means that GateIn Portal application itself configures and creates the datasources.

Configuring the database for JCR

To configure the database used by JCR you will need to edit the $TOMCAT_HOME/gatein/conf/configuration.properties file. Set the values of driver, URL, username and password with the values for your JDBC connection. Refer to your database JDBC driver documentation for more details.

gatein.jcr.datasource.driver=org.hsqldb.jdbcDriver
gatein.jcr.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcjcr_${name}
gatein.jcr.datasource.username=sa
gatein.jcr.datasource.password=

By default, the name of the database is "jdbcjcr_${name}" - ${name} should be a part of the database name, as it is dynamically replaced by the name of the portal container extension.

In the case of HSQL, the databases are created automatically. For any other RDBMS, you will need to create a database named jdbcjcr_portal (and if you have additional portals deployed you will have to create additional databases named "jdbcjcr_PORTAL-NAME" for each additional portal deployed - note that some databases do not accept "-" in the database name, so you may have to rename your additional portals accordingly).

Make sure the user has rights to create tables on jdbcjcr_portal, and to update them as they will be automatically created during the first startup.

Also, add your database's JDBC driver into the classpath, typically through copying the driver JAR file to $TOMCAT_HOME/lib directory.

Let's configure our JCR to store data in MySQL. Say there exists a user named "gateinuser" with a password "gateinpassword" in MySQL. Then, we create a database mygateindb_portal} (remember that {{_portal is required), and assign our user the rights to create tables.

Then we need to add MySQL's JDBC driver to the classpath, and finally edit $TOMCAT_HOME/gatein/conf/configuration.properties to contain the following:

MySQL
gatein.jcr.datasource.driver=com.mysql.jdbc.Driver
gatein.jcr.datasource.url=jdbc:mysql://localhost:3306/mygateindb${container.name.suffix}
gatein.jcr.datasource.username=gateinuser
gatein.jcr.datasource.password=gateinpassword

Configuring the database for the default identity store

By default, users are stored in a relational database. To change the database in which to store users, you will need to edit the same file as for JCR: $TOMCAT_HOME/gatein/conf/configuration.properties

Configuration is analogous to the one for JCR datasource, just that it uses different property keys:

gatein.idm.datasource.driver=org.hsqldb.jdbcDriver
gatein.idm.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcidm_${name}
gatein.idm.datasource.username=sa
gatein.idm.datasource.password=
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 13:09:58 UTC, last content change 2013-06-03 08:45:37 UTC.